<?php include('navigation.php');
?>
<!-- End Navigation -->
<div class="modal fade" id="votemodal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button aria-hidden="true" class="close" data-dismiss="modal" type="button">&times;</button>
                <h4 class="modal-title">
                    投票参数修改
                </h4>
            </div>
            <div class="modal-body">
                <center><a href="index.php"><img width="200" height="70" src="images/logo-login%402x.png"/></a></center>
                <p></p>

                <form method="post" action="shenhe.do.php?do=voteconfig" enctype="multipart/form-data">
                    <div class="form-group row">
                        <label class="control-label col-md-4">投票标题:</label>

                        <div class="col-md-8">
                            <input class="form-control" name="votetiltle" value="<?php echo  $xuanzezu['votetitle']; ?>" type="text">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="control-label col-md-4">前台刷新时间(秒):</label>

                        <div class="col-md-8">
                            <input class="form-control" name="voterefresht" value="<?php echo  $xuanzezu['votefresht']; ?>" type="text">
                        </div>
                    </div>
                    <div class="form-group row">
                        <label class="control-label col-md-4">每个用户投票数(数字):</label>

                        <div class="col-md-8">
                            <select name="votecannum">
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                                <option value="6">6</option>
                                <option value="7">7</option>
                                <option value="8">8</option>
                                <option value="9">9</option>
                                <option value="10">10</option>
                                <option value="20">20</option>
                            </select>
                            当前每人可投<?php echo  $xuanzezu['votecannum']; ?>票
                        </div>
                    </div>

                    <div class="form-group row">
                        <label class="control-label col-md-4">前台投票显示方式：</label>

                        <div class="col-md-8">
                            <?php
                            for ($i = 1; $i <= 3; $i++) {
                                if ($xuanzezu['voteshowway'] == $i) {
                                    $checked = "checked";
                                } else {
                                    $checked = "";
                                }
                                if ($i == 1) {
                                    $voteshowway = "扇形";
                                } else if ($i == 2) {
                                    $voteshowway = "柱形（横）";
                                } else if ($i == 3) {
                                    $voteshowway = "柱形（竖）";
                                }
                                echo '<label class="radio-inline"><input name="voteshowway"' . $checked . ' type="radio" value="' . $i . '"><span>' . $voteshowway . '</span></label>';
                            }
                            ?>

                            </label>
                        </div>
                    </div>
            </div>

            <div class="modal-footer">
                <input class="btn btn-primary" type="submit" value="确定">
                <button class="btn btn-default-outline" data-dismiss="modal" type="button">关闭</button>
                </form>
            </div>
        </div>
    </div>
</div>
<div class="container main-content">
    <!-- DataTables Example -->
    <div class="row">
        <div class="col-lg-12">
            <div class="widget-container fluid-height clearfix">
                <div class="heading">
                    <?php
                    $vote_m=new M('vote');
                    $votes=$vote_m->select();
//                    $toupiao = "SELECT * FROM  `weixin_vote`";
//                    $querytp = mysql_query($toupiao, $link) or die(mysql_error());
//                    $numdel = mysql_num_rows($querytp);
                    $numdel= count($votes);
                    ?>
                    <i class="icon-table"></i>投票管理<a class="btn btn-sm btn-primary-outline pull-right"
                                                     href="shenhe.do.php?do=zengjian&cid=1&numdel=<?php echo  $numdel; ?>"><i
                            class="icon-plus"></i>增加一行</a><a class="btn btn-sm btn-primary-outline pull-right"
                                                             data-toggle="modal" href="#votemodal"><i
                            class="icon-gear"></i>投票参数</a><a class="btn btn-sm btn-primary-outline pull-right"
                                                             href="shenhe.do.php?do=chongzhi&cid=<?php echo  $numdel; ?>"><i
                            class="icon-ban-circle"></i>投票清零</a>
                </div>
                <div class="widget-content padded clearfix">
                    <table class="table table-bordered table-striped" id="datatable-editable">
                        <thead>
                        <th class="check-header hidden-xs">
                            <label><input id="checkAll" name="checkAll" type="checkbox"><span></span></label>
                        </th>
                        <th>
                            序号
                        </th>
                        <th>
                            名称
                        </th>
                        <th class="hidden-xs">
                            票数
                        </th>
                        <th></th>
                        </thead>
                        <tbody>
                        <?php
                        $i = 1;
                        foreach($votes as $q){


//                        while ($q = mysql_fetch_row($querytp)) {
                            ?>

                            <tr name="<?php echo  $q['id']; ?>">
                                <td class="check hidden-xs">
                                    <label><input name="optionsRadios1" type="checkbox"
                                                  value="option1"><span></span></label>
                                </td>
                                <td><?php echo  $q['id']; ?></td>
                                <td>
                                    <?php echo  $q['name']; ?>
                                </td>
                                <td class="hidden-xs">
                                    <?php echo  $q['res']; ?>
                                </td>
                                <td class="actions">
                                    <a class="edit-row" href="javascript:void(0)"><i class="icon-pencil"></i></a>
                                    <a class="dete-row" href="shenhe.do.php?do=zengjian&cid=2&numdel=<?php echo  $q['id']; ?>"><i
                                            class="icon-trash"></i></a>
                                </td>
                            </tr>
                            <?php $i++;
//                        }
                        }
                        ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <!-- end DataTables Example -->
</div>
</div>
</div>
</body>

</html>